package com.ly.common.running.service;

import com.ly.common.running.impl.IBaseFlowHandle;
import com.ly.common.running.model.BaseInOut;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author luoyana
 * @version V1.0
 * @ClassName AbstractFlow
 * @description Stria实现
 * @update 2023/6/8
 */
@Service
public class AbstractStria<In extends BaseInOut,Out extends BaseInOut> implements IBaseFlowHandle<In,Out> {
    @Resource
    FlowExecutor flowExecutor;
    @Override
    public Out execute(In in,String beanName,Class<Out> outClass) {
        LiteflowResponse response = flowExecutor.execute2Resp(beanName,in, outClass);
        return response.getSlot().getContextBean(outClass);
    }

    @Override
    public String getKey() {
        return "Stria";
    }
}
